package com.example.planstudio;

import android.app.Service;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;

public class ClockActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_clock);
//        Button button = findViewById(R.id.bt_countdown);

        Intent intent = getIntent();
        String msg = intent.getStringExtra("msg");
        TextView textView = findViewById(R.id.textView);
//        //获得系统的音频对象
        AudioManager aManager = (AudioManager) getSystemService(Service.AUDIO_SERVICE);
        //初始化mediaplayer对象,这里播放的是raw文件中的mp3资源
        MediaPlayer mePlayer = MediaPlayer.create(ClockActivity.this,R.raw.test);
//        设置循环播放:
//        mePlayer.start();

        if(msg == "起床"){
            textView.setText("太阳出来我晒太阳喽！");
//            mePlayer = MediaPlayer.create(ClockActivity.this, R.raw.hutao_morning);
        } else if (msg == "吃饭") {
            textView.setText("到吃饭时间啦！！");
//            mePlayer = MediaPlayer.create(ClockActivity.this, R.raw.keli_lunch);
        }
//        mePlayer.setLooping(true);
//        mePlayer.start();

    }
}